angular.module('app', ['ui.router'])
    .constant('APP_CONFIG', {
        PATH_COMPONENT: 'app/components/',
    })
    .run(['$rootScope', function ($rootScope) {
        $rootScope.$on('$stateChangeStart', function (event, next, p, prev) {

        });
    }])
    .config(['$stateProvider', '$urlRouterProvider', 'APP_CONFIG',
        function ($stateProvider, $urlRouterProvider, APP_CONFIG) {

            $urlRouterProvider.otherwise("/");

            $stateProvider
                .state('qf', {
                    url: "/",
                    views: {
                        'header': {
                            templateUrl: APP_CONFIG.PATH_COMPONENT + 'header/header.html',
                            controller: 'headerController'
                        },
                        'side': {
                            templateUrl: APP_CONFIG.PATH_COMPONENT + 'side/side.html',
                            controller: 'sideController'
                        },
                        '@': {
                            templateUrl: APP_CONFIG.PATH_COMPONENT + 'home/home.html',
                            controller: 'homeController'
                        }
                    }
                })
                .state('qf.demo', {
                    url: "demo/:id",
                    views: {
                        '@': {
                            templateUrl: APP_CONFIG.PATH_COMPONENT + 'demo/demo.html',
                            controller: 'demoController'
                        }
                    }
                })
        }
    ]);